//
//  AutomationCell.h
//  OST
//
//  Created by mac on 13-7-6.
//  Copyright (c) 2013年 mac. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "ASIHTTPRequest.h"
#import "PersistableInfo.h"
#import <UIKit/UIGestureRecognizerSubclass.h>
#import "SWTableViewCell.h"
@class AutomationCell;

@protocol AutomationCellDelegate <NSObject>

@optional
- (void)changeInfo:(NSDictionary *)data cell:(AutomationCell*)cell;
- (void)startTimer;
- (void)switcherOnChangedValue:(BOOL)swValue data:(NSDictionary *)data cell:(AutomationCell*)cell;


@end

typedef enum
{
    AutomationTypeBinarySwitch = 1,
    AutomationTypeMultiLvSwitch = 2,
    AutomationTypeBinarySensor = 3,
    AutomationTypeMultiLvSensor = 4,
    
    AutomationTypeMeter = 5,
    //!门锁
    AutomationTypeDoorLock = 7,
    AutomationTypeMotorCurtain = 8,
} AutomationType;
@interface AutomationCell : UITableViewCell<ASIHTTPRequestDelegate>
{
    

}

@property (nonatomic, assign) id<AutomationCellDelegate> adelegate;


@property (nonatomic, strong) ASIHTTPRequest *httpRequest;

@property (nonatomic, strong) IBOutlet UILabel *labelName;
@property (nonatomic, strong) IBOutlet UIImageView *icon;
@property (nonatomic, strong) IBOutlet UIButton *switcher;
@property (nonatomic, strong) IBOutlet UISlider *slider;
@property (nonatomic, strong) IBOutlet UIButton *btnChangeInfo;

@property (nonatomic, strong) IBOutlet UIButton *btnSensorBetterLv;
@property (nonatomic,strong) IBOutlet UILabel *labelSensorTemperature;
@property (nonatomic, strong) IBOutlet UIView *curtainCtrlView;
@property (nonatomic, strong) NSDictionary *data;


-(void)initView;
-(void)setCellData:(NSDictionary *)data;
-(void)setupInitValueToAutomationController:(NSDictionary *)status;
+(PersistableInfo *)getAutoMationInfo:(NSDictionary *)mdata;
-(void)updateIcon;

//-(void)open;
//-(void)close;

- (void)curtainCtrlOpened;
- (void)curtainCtrlClocsed;


@end
